package com.linkoog.devtools.code_generator.wizard.generate.database;

import com.intellij.openapi.project.Project;
import com.linkoog.devtools.code_generator.wizard.generate.database.table.DbtableSelectStepPanel;
import com.linkoog.devtools.intellij.wizard.WizardContext;
import com.linkoog.devtools.intellij.wizard.WizardStep;
import com.intellij.openapi.options.ConfigurationException;

import javax.swing.*;


public class DbTableSelectConfigStep extends WizardStep {

    private DbtableSelectStepPanel contextPanel;

    public DbTableSelectConfigStep(Project project, WizardContext wizardContext) {
        super(project, wizardContext);
    }

    @Override
    public JComponent getComponent() {
        if (contextPanel == null){
            this.contextPanel = new DbtableSelectStepPanel();
        }
        return contextPanel.getMyMainPanel();
    }

    @Override
    public boolean validate() throws ConfigurationException {
        return contextPanel.validate();
    }

    @Override
    public void onStepOK() {
        contextPanel.finish(getWizardContext());
    }
}
